package com.study.testTryWith;

/**
 * 
 * @描述: 测试 try-with-resource 语法
 * @版权: Copyright (c) 2020 
 * @公司: 
 * @作者: 严磊
 * @版本: 1.0 
 * @创建日期: 2020年5月31日 
 * @创建时间: 上午11:50:45
 */
public class test
{
    public static void main(String[] args) {
        try(Resource resource = new Resource()) {
            resource.hello(true);
        } catch (Exception e) {
            e.printStackTrace();
        }
        
    }
    
    /*
              执行结果：
     hello-func-start
     Resource is closed -func-start
     java.lang.RuntimeException: 测试执行过程抛出异常
        at com.study.bloomFilter.redisBloom.testTryWith.Resource.hello(Resource.java:24)
        at com.study.bloomFilter.redisBloom.testTryWith.test.main(test.java:17)
        Suppressed: java.lang.RuntimeException: 测试资源关闭时抛出异常
            at com.study.bloomFilter.redisBloom.testTryWith.Resource.close(Resource.java:37)
            at com.study.bloomFilter.redisBloom.testTryWith.test.main(test.java:18)
              或
     hello-func-start
     hello-func-end
     Resource is closed -func-start
     com.study.bloomFilter.error.BloomFilterException: 测试资源关闭时抛出异常
        at com.study.testTryWith.Resource.close(Resource.java:36)
        at com.study.testTryWith.test.main(test.java:18)

     */
}
